<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<title>
			Python Open Flash Chart (pyOFC2) &mdash;  Lines & Spoke labels 
		</title>
		<meta name="author" content="Pradeep Kishore Gowda">

		<link rel="stylesheet" href="css/reset-fonts-grids.css" type="text/css">
		<link rel="stylesheet" href="css/style.css" type="text/css"> 
		<link rel="stylesheet" href="css/pygments.css" type="text/css"> 		
				
	<script type="text/javascript" src="js/swfobject.js">
	</script>
	<script type="text/javascript">
		swfobject.embedSWF(
			"open-flash-chart.swf", "chart_radar_charts_2", "780", "300",
			"9.0.0", "expressInstall.swf",
			{"data-file":"data/radar_charts_2.json"}
		);
	</script>

	</head>
	<body>
		<div id="doc2" class="yui-t2">
			<div id="hd">
				<h1>
					<a href="index.html">pyOFC2</a> Python Open Flash Chart 2
				</h1>
			</div>
			<div id="bd">
				<div id="yui-main">
					<div class="yui-b">
						<div class="yui-g">
							
	<h2>Lines & Spoke labels</h2>
	<div id="chart_radar_charts_2"></div>
	<div id="doc"><p>Radar Chart  with lines, spoke labels and keys
For radar charts it is neccessary to set the line style to 'loop' so the first and last points are connected.
In the above example you can see that the gold line has not had its loop attribute set.</p>

<p>The default tooltip is of no use with radar charts so we change its behaviour to proximity.</p>
</div>
	<pre><div class="syntax"><pre><span class="k">def</span> <span class="nf">test_radar_charts_2</span><span class="p">():</span>
    
    <span class="n">chart</span> <span class="o">=</span> <span class="n">open_flash_chart</span><span class="p">()</span> 
    <span class="n">chart</span><span class="o">.</span><span class="n">title</span> <span class="o">=</span> <span class="n">title</span><span class="p">(</span><span class="n">text</span><span class="o">=</span><span class="s">&#39;Radar Chart&#39;</span><span class="p">)</span>
    <span class="n">line1</span> <span class="o">=</span> <span class="n">line_hollow</span><span class="p">()</span>
    <span class="n">line1</span><span class="o">.</span><span class="n">width</span> <span class="o">=</span> <span class="mf">1</span>
    <span class="n">line1</span><span class="o">.</span><span class="n">dot_size</span> <span class="o">=</span> <span class="mf">3</span>
    <span class="n">line1</span><span class="o">.</span><span class="n">halo_size</span> <span class="o">=</span> <span class="mf">2</span>
    <span class="n">line1</span><span class="o">.</span><span class="n">colour</span> <span class="o">=</span> <span class="s">&#39;#FBB829&#39;</span>
    <span class="n">line1</span><span class="o">.</span><span class="n">values</span> <span class="o">=</span> <span class="p">[</span><span class="mf">3</span><span class="p">,</span> <span class="mf">4</span><span class="p">,</span> <span class="mf">5</span><span class="p">,</span> <span class="mf">4</span><span class="p">,</span> <span class="mf">3</span><span class="p">,</span> <span class="mf">3</span><span class="p">,</span> <span class="mf">2.5</span><span class="p">]</span>
    <span class="n">line1</span><span class="o">.</span><span class="n">tip</span> <span class="o">=</span> <span class="s">&quot;Gold #val#&quot;</span>
    <span class="n">line1</span><span class="o">.</span><span class="n">text</span> <span class="o">=</span> <span class="s">&#39;Mr. Gold&#39;</span>
    <span class="n">line1</span><span class="o">.</span><span class="n">font_size</span> <span class="o">=</span> <span class="mf">10</span>
    <span class="n">chart</span><span class="o">.</span><span class="n">add_element</span><span class="p">(</span><span class="n">line1</span><span class="p">)</span>
    
    <span class="n">line2</span> <span class="o">=</span> <span class="n">line_dot</span><span class="p">()</span>
    <span class="n">line2</span><span class="o">.</span><span class="n">values</span> <span class="o">=</span> <span class="p">[</span><span class="mf">2</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mf">7</span><span class="p">)]</span>
    <span class="n">line2</span><span class="o">.</span><span class="n">halo_size</span> <span class="o">=</span> <span class="mf">2</span>
    <span class="n">line2</span><span class="o">.</span><span class="n">width</span> <span class="o">=</span> <span class="mf">1</span>
    <span class="n">line2</span><span class="o">.</span><span class="n">dot_size</span> <span class="o">=</span> <span class="mf">3</span>
    <span class="n">line2</span><span class="o">.</span><span class="n">colour</span> <span class="o">=</span> <span class="s">&#39;#80000FF&#39;</span>
    <span class="n">line2</span><span class="o">.</span><span class="n">tip</span> <span class="o">=</span> <span class="s">&#39;Purple #val#&#39;</span>
    <span class="n">line2</span><span class="o">.</span><span class="n">text</span> <span class="o">=</span> <span class="s">&#39;Mr. Purple&#39;</span>
    <span class="n">line2</span><span class="o">.</span><span class="n">font_size</span> <span class="o">=</span> <span class="mf">10</span>
    <span class="n">line2</span><span class="o">.</span><span class="n">loop</span> <span class="o">=</span> <span class="bp">True</span>
    <span class="n">chart</span><span class="o">.</span><span class="n">add_element</span><span class="p">(</span><span class="n">line2</span><span class="p">)</span>
     
    <span class="n">r</span> <span class="o">=</span> <span class="n">radar_axis</span><span class="p">(</span><span class="nb">max</span><span class="o">=</span><span class="mf">5</span><span class="p">)</span>
    <span class="n">r</span><span class="o">.</span><span class="n">colour</span> <span class="o">=</span><span class="s">&#39;#DAD5E0&#39;</span>
    <span class="n">r</span><span class="o">.</span><span class="n">grid_colour</span> <span class="o">=</span> <span class="s">&#39;#DAD5E0&#39;</span>
    <span class="n">ra</span> <span class="o">=</span> <span class="n">radar_axis_labels</span><span class="p">(</span><span class="n">labels</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;Zero&#39;</span><span class="p">,</span><span class="s">&#39;&#39;</span><span class="p">,</span><span class="s">&#39;&#39;</span><span class="p">,</span><span class="s">&#39;Middle&#39;</span><span class="p">,</span><span class="s">&#39;&#39;</span><span class="p">,</span><span class="s">&#39;High&#39;</span><span class="p">])</span>
    <span class="n">ra</span><span class="o">.</span><span class="n">colour</span> <span class="o">=</span> <span class="s">&#39;#9F819F&#39;</span>
    <span class="n">r</span><span class="o">.</span><span class="n">labels</span> <span class="o">=</span> <span class="n">ra</span>
    <span class="n">sa</span> <span class="o">=</span> <span class="n">radar_spoke_labels</span><span class="p">(</span><span class="n">labels</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;Strength&#39;</span><span class="p">,</span> <span class="s">&#39;Smarts&#39;</span><span class="p">,</span> <span class="s">&#39;Sweet&lt;br&gt;Tooth&#39;</span><span class="p">,</span>
            <span class="s">&#39;Armour&#39;</span><span class="p">,</span> <span class="s">&#39;Max Hit Points&#39;</span><span class="p">,</span> <span class="s">&#39;???&#39;</span><span class="p">,</span> <span class="s">&#39;Looks Like a Monkey&#39;</span><span class="p">])</span>
    <span class="n">sa</span><span class="o">.</span><span class="n">colour</span> <span class="o">=</span> <span class="s">&#39;#9F819F&#39;</span>
    <span class="n">chart</span><span class="o">.</span><span class="n">radar_axis</span> <span class="o">=</span> <span class="n">r</span> 
    <span class="n">r</span><span class="o">.</span><span class="n">spoke_labels</span> <span class="o">=</span> <span class="n">sa</span>
    <span class="n">tip</span> <span class="o">=</span> <span class="n">tooltip</span><span class="p">()</span>
    <span class="n">tip</span><span class="o">.</span><span class="n">proximity</span> <span class="o">=</span> <span class="mf">1</span>
    <span class="n">chart</span><span class="o">.</span><span class="n">tooltip</span> <span class="o">=</span> <span class="n">tip</span>
    <span class="n">chart</span><span class="o">.</span><span class="n">bg_colour</span> <span class="o">=</span> <span class="s">&#39;#FFFFFF&#39;</span>
    <span class="k">return</span> <span class="n">chart</span>
</pre></div>
</pre> 
	<div id="json">
		<p>Data used to generate the chart &mdash; <a href="data/radar_charts_2.json">radar_charts_2.json</a></p>
	</div>

							
						</div>
					</div>
				</div>
				<div class="yui-b" id="sidebar"> 
					<h3>
						Chart Demos
					</h3>
					    <dl><dt class="el2">Area Charts</dt><dd>
<li><a href="area_hollow.html">Area Hollow Chart</a></li>
<li><a href="area_line.html">Area Line Chart</a></li>
</dd>
<dt class="el2">Bar Charts</dt><dd>
<li><a href="bar.html">Bar Chart</a></li>
<li><a href="bar_2.html">Bar Chart 2</a></li>
</dd>
<dt class="el2">Bar Filled Charts</dt><dd>
<li><a href="bar_filled.html">Bar Filled Chart</a></li>
</dd>
<dt class="el2">Horizontal Bar Charts</dt><dd>
<li><a href="horizontal_bar.html">Horizontal Bar Chart</a></li>
</dd>
<dt class="el2">Line Charts</dt><dd>
<li><a href="line.html">Line</a></li>
<li><a href="line_dot.html">Line Dot</a></li>
<li><a href="line_hollow.html">Line Hollow</a></li>
<li><a href="manylines.html">Many Lines</a></li>
</dd>
<dt class="el2">Radar Charts</dt><dd>
<li><a href="radar_charts_1.html">Radar Chart</a></li>
<li><a href="radar_charts_2.html">Lines & Spoke labels</a></li>
<li><a href="radar_charts_3.html">Stepped axis</a></li>
</dd>
<dt class="el2">Scatter Charts</dt><dd>
<li><a href="scatter_chart.html">Scatter Chart</a></li>
<li><a href="scatter_line_chart.html">Scatter Line Chart</a></li>
</dd>
<dt class="el2">Shapes</dt><dd>
<li><a href="shape.html">Shapes</a></li>
</dd>
<dt class="el2">X Axis Labels</dt><dd>
<li><a href="x_axis_labels_1.html">X Axis Labels 1</a></li>
<li><a href="x_axis_labels_3.html">X Axis Labels 3</a></li>
</dd></dl> 
					<h3>
						Resources
					</h3>
					<ul>
						<li>
							<a href="http://teethgrinder.co.uk/open-flash-chart-2/">Open Flash Chart</a>
						</li>
						<li>
							<a href="http://github.com/btbytes/pyofc2">pyOFC2 source (github)</a>
						</li>
					</ul>
				</div>
			</div>
			<div id="ft">
			  &copy; 2009 <a href="http://pradeepgowda.com/">Pradeep Kishore Gowda</a>
			</div>
		</div>
	</body>
</html>